<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
use Cart;
class orderController extends Controller
{
   

    /**
     * 支付生成订单控制器
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //生成订单编号
      $order = [
        'dnh' =>md5(123).time(),
        'uid' =>$request->uid,
        'mid'=>$request->mid,
        'good'=>$request->spname,
        'status'=>1,
        'time'=> time(),
        'address' =>$request->address,
        'money'=>$request->spsub,
        'num'=>$request->spnum
 
      ];
      
      $new=DB::table('indent')->insert($order);
      if($new){
        $uid = $request->uid;
        Cart::instance($uid)->destroy();
        return view('home.order');
      }
    }

   
}
